package cn.elwy.rcp.ui;

import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class Activator implements BundleActivator {

  public static final String PLUGIN_ID = "cn.elwy.rcp.ui"; //$NON-NLS-1$

  private static final Logger logger = LoggerFactory.getLogger(Activator.class);

  private static BundleContext context;

  static BundleContext getContext() {
    return context;
  }

  /*
   * (non-Javadoc)
   * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
   */
  public void start(BundleContext bundleContext) throws Exception {
    Activator.context = bundleContext;
  }

  /*
   * (non-Javadoc)
   * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
   */
  public void stop(BundleContext bundleContext) throws Exception {
    Activator.context = null;
    try {
      AppImage.dispose();
    } catch (Exception e) {
      logger.error(e.getMessage(), e);
    }
  }

}
